﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Utility
{
    public class ExceptionHelper
    {
        private static Logger logger = new Logger(typeof(ExceptionHelper));
        public static void TryCatch(Action act)
        {
            try
            {
                act.Invoke();
            }
            catch (global::System.Exception ex)
            {
                logger.Error(string.Format("**********{0}:在执行{1}时发生异常，{2}", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), act.Method.Name, ex.Message));
            }
        }
    }
}
